package com.otaku.crawler.util;

import org.w3c.dom.Element;

public class ElementHelper {
	/**
	 * when element look like this:
	 * ==================================
	 * <div class="left_img">
       	<div style="width: auto; text-align: center;">
         <a href="/cn/Extra-30-off-Express-Mens-Sweaters/232136.html"> 
          <img src="http://img.dealmoon.com/images/c/13/04/11/2p4h3AM.jpg" surl="http://img.dealmoon.com/images/c/13/04/11/2p4h3AM.jpg" alt=" Express: 男式羊毛衫,额外30% off" class="left_prod_img" style="display: inline;">
         </a>
        </div>
       </div>
       ==================================
	 * @param e
	 * @param deep :starts with 0
	 * @param attriName
	 * @return
	 */
	public static String getAttributeValueInOneLevel(Element e,int deep,String attriName){
		Element e1 = e;
		while(deep>=1){
			e1 = (Element) e.getFirstChild();
			deep--;
		}
		return e1.getAttribute(attriName);
	}
}
